#include "drv_OpticalCar_Motor.h"


static void Motor1_Forward(void) {
    Car_PWM_A1_Output(PWM_LOW_LEV);
    Car_PWM_A2_Output(PWM_PULSE);
}

static void Motor1_Backward(void) {
    Car_PWM_A1_Output(PWM_PULSE);
    Car_PWM_A2_Output(PWM_LOW_LEV);
}

static void Motor2_Forward(void) {
    Car_PWM_B1_Output(PWM_LOW_LEV);
    Car_PWM_B2_Output(PWM_PULSE);
}

static void Motor2_Backward(void) {
    Car_PWM_B1_Output(PWM_PULSE);
    Car_PWM_B2_Output(PWM_LOW_LEV);
}


void Car_Forward(void) {
    Motor1_Forward();
    Motor2_Forward();
}


void Car_Backward(void) {
    Motor1_Backward();
    Motor2_Backward();
}


void Car_TurnLeft(void) {
    Motor1_Backward();
    Motor2_Forward();
}


void Car_TurnRight(void) {
    Motor1_Forward();
    Motor2_Backward();
}


void Car_Stop(void) {
    Car_PWM_A1_Output(PWM_LOW_LEV);
    Car_PWM_A2_Output(PWM_LOW_LEV);
    Car_PWM_B1_Output(PWM_LOW_LEV);
    Car_PWM_B2_Output(PWM_LOW_LEV);
}
